package com.lzy.web;

import cn.hutool.json.JSONUtil;
import com.lzy.RestResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.core.util.JsonUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jay by 2019/08/23
 */
@RestController
@Slf4j
public class FallbackController {
    @GetMapping("/fallback")
    public RestResponseResult getFallback() {
        RestResponseResult response = RestResponseResult.failResponse(100, "服务暂时不可用");
        log.info("result:{}", JSONUtil.parseObj(response));
        return response;
    }

    @PostMapping("/fallback")
    public RestResponseResult postFallback() {
        RestResponseResult response = RestResponseResult.failResponse(100, "服务暂时不可用");
        log.info("result:{}", JSONUtil.parseObj(response));
        return response;
    }

    @GetMapping("/fallback3")
    public RestResponseResult postFallback3() {
        RestResponseResult response = RestResponseResult.failResponse(100, "服务暂时不可用");
        log.info("result:{}", JSONUtil.parseObj(response));
        return response;
    }

}
